<?php namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Config\Services;
use CodeIgniter\Controller;
use CodeIgniter\I18n\Time;

class Home extends Controller
{
	public function index()
	{
		
        
	}
	//--------------------------------------------------------------------

    // api 输出 json
    public function api()
	{
		$data = [
			"total_users" => 3,
			"users" => [
				[
					"id" => 1,
					"name" => "Nitya",
					"address" => [
						"country" => "India",
						"city" => "Kolkata",
						"zip" => 700102,
					]
				],
				[
					"id" => 2,
					"name" => "John",
					"address" => [
						"country" => "USA",
						"city" => "Newyork",
						"zip" => "NY1234",
					]
				],
				[
					"id" => 3,
					"name" => "Viktor",
					"address" => [
						"country" => "Australia",
						"city" => "Sydney",
						"zip" => 123456,
					]
				],
			]
		];
		return $this->respond($data);
	}
}